package com.naiterui.ehp.bs.pharmacist.entity;

// default package

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

import com.naiterui.ehp.bp.constants.CommonConstant;

/**
 * DocMedicationRecom entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "dr_medication_recom")
@DynamicUpdate
public class MedicationRecom implements java.io.Serializable {

    /**
     * 推荐类型-普通推荐
     */
    public static final int RECOM_TYPE_MANNUL = 1;
    /**
     * 推荐类型-求药推荐
     */
    public static final int RECOM_TYPE_REQUIRE = 2;
    /**
     * 推荐类型-系统推荐
     */
    public static final int RECOM_TYPE_SYSTEM = 3;

    /**
     * 强制推荐标识 0:推荐未发送
     */
    public static final int FORCE_RECOM_STATUS_NOT_SEND = 0;
    /**
     * 强制推荐标识 1:非强制推荐发送
     */
    public static final int FORCE_RECOM_STATUS_SEND = 1;
    /**
     * 强制推荐标识 2:强制推荐(不进行电子签名)发送
     */
    public static final int FORCE_RECOM_STATUS_FORCE_SEND = 2;
    // Fields

    /**
     * 同意病历数据收集：非阳光化医生和老版app医生数据默认同意
     **/
    public static final int COLLECT_STATUS_AGREE = 1;
    /**
     * 不同意同意病历数据收集
     **/
    public static final int COLLECT_STATUS_AGREE_NOT = 2;
    /**
     * 不提示病历数据收集
     **/
    public static final int COLLECT_STATUS_NOT_TIPS = 3;
    /**
     * 暂不同意病历数据收集
     **/
    public static final int COLLECT_STATUS_AGREE_NEVER = 4;
    /**
     * 作废状态：0 未作废（默认） 1 已作废
     */
    public static final int INVALID_DEFAULT = 0;
    /**
     * 作废状态：0 未作废（默认） 1 已作废
     */
    public static final int INVALID_YES = 1;
    /**
     * 数据来源：0 app(默认)
     */
    public static final int DATA_SOURCE_DEFAULT = 0;
    /**
     * 安全限购发送状态：0 未强制发送（默认） 1 触发安全限购仍然发送
     */
    public static final int SAFE_STATUS_DEFAULT = 0;
    /**
     * 安全限购发送状态：0 未强制发送（默认） 1 触发安全限购仍然发送
     */
    public static final int SAFE_STATUS_FORCE = 1;
    /**
     *
     */
    private static final long serialVersionUID = -207725987946355840L;
    private Long id;
    private Long doctorId;
    private Long patientId;
    private String orderId;
    /**
     * 问诊会话id：<code>sessionId</code>
     */
    private Long sessionId;
    private Integer orderAmount;
    /**
     * 推荐类型：<code>type</code>
     * 1普通推荐,2求药推荐,3系统推荐
     */
    private Integer type;
    private Long requireId;
    /**
     * 推荐用药是否购药，0：未购，1：已全部购买，2：已下单（未回调），3：部分购买, 4:已取消
     */
    private Integer status;
    private String extId;
    private Date createdAt;
    private Date changedAt;
    private Date expireAt;
    /**
     * 处方笺流水号：<code>serialNumber</code>
     */
    private String serialNumber;
    /**
     * 处方笺临床诊断：<code>diagnosis</code>
     */
    private String diagnosis;
    /**
     * 强制推荐标识 0:推荐未发送, 1:非强制推荐,2:强制推荐(不进行电子签名)：<code>forceRecom</code>
     */
    private Integer forceRecom;

    /**
     * 续方列表是否已删除(0-否,1-是)
     */
    private Byte visiable;

    /**
     * 病历数据收集状态：1：同意收集，2：不同意收集， 3：未提示是否同意，4：暂不同意
     */
    private Integer collectStatus;

    /**
     * 续方来源推荐Id 【医生端V3.4.0-by gongbaoqiang】
     */
    private Long originRecom;
    /**
     * 数据来源渠道： 0 app(默认)，以后可扩展该字段值【医生端V3.4.0-by gongbaoqiang】
     */
    private Integer dataSource;

    /**
     * 触发安全用药发送标记：0 正常  1 非安全用药强制发送【医生端V3.4.0-by gongbaoqiang】
     */
    private Integer safeStatus;

    /**
     * 作废状态：0 正常  1 作废【医生端V3.4.0-by gongbaoqiang】
     */
    private Integer invalid;

    /**
     * 作废时间【医生端V3.4.0-by gongbaoqiang】
     */
    private Date invalidAt;
    /**
     * 上次申请购药时间
     */
    private Date lastRequireAt;

    /**
     * 创建MedicationRecom实例
     *
     * @throws 异常信息
     */
    public MedicationRecom() {
        super();
    }

    /**
     * 创建MedicationRecom实例
     *
     * @param doctorId
     * @param patientId
     *
     * @throws 异常信息
     */
    public MedicationRecom(Long doctorId, Long patientId, String extId, Long expiration, Integer type, Long requireId, Integer forceRecom,
                           String diagnosis) {
        super();
        this.doctorId = doctorId;
        this.patientId = patientId;
        this.status = CommonConstant.DOCTOR_RECOM_STATUS_NOT_BUY;
        this.extId = extId;
        this.type = type;
        this.requireId = requireId;
        Date date = new Date();
        this.createdAt = date;
        this.changedAt = date;
        this.expireAt = new Date(date.getTime() + expiration);
        this.diagnosis = diagnosis;
        this.forceRecom = forceRecom;
    }

    // Property accessors
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "doctor_id")
    public Long getDoctorId() {
        return this.doctorId;
    }

    public void setDoctorId(Long doctorId) {
        this.doctorId = doctorId;
    }

    @Column(name = "patient_id")
    public Long getPatientId() {
        return this.patientId;
    }

    public void setPatientId(Long patientId) {
        this.patientId = patientId;
    }

    @Column(name = "order_id")
    public String getOrderId() {
        return this.orderId;
    }

    /**
     * @return Long 取得域 sessionId 的方法。
     */
    @Column(name = "session_id")
    public Long getSessionId() {
        return sessionId;
    }

    /**
     * @param sessionId 对域 sessionId 的设置方法.
     */
    public void setSessionId(Long sessionId) {
        this.sessionId = sessionId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    @Column(name = "order_amount")
    public Integer getOrderAmount() {
        return this.orderAmount;
    }

    public void setOrderAmount(Integer orderAmount) {
        this.orderAmount = orderAmount;
    }

    @Column(name = "status")
    public Integer getStatus() {
        return this.status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Column(name = "ext_id")
    public String getExtId() {
        return extId;
    }

    public void setExtId(String extId) {
        this.extId = extId;
    }

    @Column(name = "created_at", length = 19)
    public Date getCreatedAt() {
        return this.createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    @Column(name = "changed_at", length = 19)
    public Date getChangedAt() {
        return this.changedAt;
    }

    public void setChangedAt(Date changedAt) {
        this.changedAt = changedAt;
    }

    /**
     * @return Date 取得域 expireAt 的方法。
     */
    @Column(name = "expire_at", length = 19)
    public Date getExpireAt() {
        return expireAt;
    }

    /**
     * @param expireAt 对域 expireAt 的设置方法.
     */
    public void setExpireAt(Date expireAt) {
        this.expireAt = expireAt;
    }

    /**
     * @return Integer 取得域 type 的方法。
     */
    @Column(name = "type")
    public Integer getType() {
        return type;
    }

    /**
     * @param type 对域 type 的设置方法.
     */
    public void setType(Integer type) {
        this.type = type;
    }

    /**
     * @return Long 取得域 requireId 的方法。
     */
    @Column(name = "require_id")
    public Long getRequireId() {
        return requireId;
    }

    /**
     * @param requireId 对域 requireId 的设置方法.
     */
    public void setRequireId(Long requireId) {
        this.requireId = requireId;
    }

    /**
     * @return String 取得域 diagnosis 的方法。
     */
    @Column(name = "diagnosis")
    public String getDiagnosis() {
        return diagnosis;
    }

    /**
     * @param diagnosis 对域 diagnosis 的设置方法.
     */
    public void setDiagnosis(String diagnosis) {
        this.diagnosis = diagnosis;
    }

    /**
     * @return String 取得域 serialNumber 的方法。
     */
    @Column(name = "serial_number")
    public String getSerialNumber() {
        return serialNumber;
    }

    /**
     * @param serialNumber 对域 serialNumber 的设置方法.
     */
    public void setSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
    }

    @Column(name = "force_recom")
    public Integer getForceRecom() {
        return forceRecom;
    }

    public void setForceRecom(Integer forceRecom) {
        this.forceRecom = forceRecom;
    }

    @Column(name = "visiable", columnDefinition = "bit")
    public Byte getVisiable() {
        return visiable;
    }

    public void setVisiable(Byte visiable) {
        this.visiable = visiable;
    }

    @Column(name = "last_require_at")
    public Date getLastRequireAt() {
        return lastRequireAt;
    }

    public void setLastRequireAt(Date lastRequireAt) {
        this.lastRequireAt = lastRequireAt;
    }

    @Column(name = "collect_status", columnDefinition = "INT default 1")
    public Integer getCollectStatus() {
        return collectStatus;
    }

    public void setCollectStatus(Integer collectStatus) {
        this.collectStatus = collectStatus;
    }

    @Column(name = "data_source", columnDefinition = "int default 0")
    public Integer getDataSource() {
        return dataSource;
    }

    public void setDataSource(Integer dataSource) {
        this.dataSource = dataSource;
    }

    @Column(name = "safe_status", columnDefinition = "int default 0")
    public Integer getSafeStatus() {
        return safeStatus;
    }

    public void setSafeStatus(Integer safeStatus) {
        this.safeStatus = safeStatus;
    }

    @Column(name = "invalid", columnDefinition = "int default 0")
    public Integer getInvalid() {
        return invalid;
    }

    public void setInvalid(Integer invalid) {
        this.invalid = invalid;
    }

    @Column(name = "invalid_at")
    public Date getInvalidAt() {
        return invalidAt;
    }

    public void setInvalidAt(Date invalidAt) {
        this.invalidAt = invalidAt;
    }

    @Column(name = "origin_recom", columnDefinition = "int default 0")
    public Long getOriginRecom() {
        return originRecom;
    }

    public void setOriginRecom(Long originRecom) {
        this.originRecom = originRecom;
    }
}